[LIBELF] Prefer PT_NOTE segments to SHT_NOTE sections for ELF notes.
authorIan Campbell <ian.campbell@xensource.com>
Mon, 19 Feb 2007 12:21:41 +0000 (12:21 +0000)
committerIan Campbell <ian.campbell@xensource.com>
Mon, 19 Feb 2007 12:21:41 +0000 (12:21 +0000)
commit6f1113b5c511bb7bea956eb9a0063e3908b781e1
tree4f8258d1b29b265205a94175a2b92ce406e87d88
parent4fca2a798152dccd59ccd5ffb12a5d3c596d9656
[LIBELF] Prefer PT_NOTE segments to SHT_NOTE sections for ELF notes.

It's always an error to try to use sections on an executable; the
segments in the phdr are definitive.

Unfortunately we cannot drop SHT_NOTE support completely due to a
binutils bug which causes kernels to have the offset field of the
PT_NOTE phdr set to zero:

http://sourceware.org/bugzilla/show_bug.cgi?id=594

This bug is present in binutils 2.17 although some distros have
backported the fix.

Therefore we simply prefer a PT_NOTE segment if we find one otherwise
we still use the SHT_NOTE section (and then the old __xen_guest
section).

Based on a patch from Jeremy Fitzhardinge.

Also added XEN_ELFNOTE_HV_START_LOW to readnotes.

Signed-off-by: Ian Campbell <ian.campbell@xensource.com>
tools/xcutils/readnotes.c
xen/common/libelf/libelf-dominfo.c
xen/common/libelf/libelf-tools.c
xen/include/public/elfnote.h
xen/include/public/libelf.h
xen/include/xen/sched.h